<?php
/**
  * 广告模型
  */
class AdModel extends CommonModel
{
	protected $_validate=array(
		array('title','require','标题必须！',self::MODEL_BOTH),
		array('start_time','require','开始时间必填',self::MODEL_BOTH),
		array('end_time','require','结束时间必填',self::MODEL_BOTH)
		);

	protected $_auto=array(
		array('add_time','time',self::MODEL_BOTH,'function'),
	    array('username','callbackAuthor',self::MODEL_BOTH,'callback'),
	    array('start_time','callbackStartTime',self::MODEL_BOTH,'callback'),
	    array('end_time','callbackEndTime',self::MODEL_BOTH,'callback')
		);

	protected function callbackStartTime()
	{
	  if(isset($_POST['start_time']))
	  {
	  	return strtotime($_POST['start_time']);
	  }else
	  		{
	  			return '0';
	  		}
	}

	protected function callbackEndTime()
	{
	  if(isset($_POST['end_time']))
	  {
	  	return strtotime($_POST['end_time']);
	  }else
	  		{
	  			return '0';
	  		}
	}					

}
?>